home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / lib / udev / findkeyboards < prev    next >
Encoding:
Text File  |  2010-12-12  |  1.7 KB  |  50 lines

  1. #!/bin/sh -e
  2. # Find "real" keyboard devices and print their device path.
  3. # Author: Martin Pitt <martin.pitt@ubuntu.com>
  4. #
  5. # Copyright (C) 2009, Canonical Ltd.
  6. #
  7. # This program is free software; you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16.  
  17.  
  18. # print a list of input devices which are keyboard-like
  19. keyboard_devices() {
  20.     # standard AT keyboard
  21.     for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do
  22.         walk=`udevadm info --attribute-walk --path=$dev`
  23.     env=`udevadm info --query=env --path=$dev`
  24.         if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then
  25.             echo -n 'AT keyboard: '
  26.     elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then
  27.             echo -n 'USB keyboard: '
  28.     else
  29.         echo -n 'Unknown type: '
  30.         fi
  31.     udevadm info --query=name --path=$dev
  32.     done
  33.  
  34.     # modules
  35.     module=`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons'`
  36.     module="$module
  37. `udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons'`"
  38.     module="$module
  39. `udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`"
  40.     for m in $module; do
  41.     evdev=`ls -d $m/event* 2>/dev/null`
  42.     if [ -e "$evdev/dev" ]; then
  43.         echo -n 'module: '
  44.         udevadm info --query=name --path=$evdev
  45.     fi
  46.     done
  47. }
  48.  
  49. keyboard_devices
  50.